/**
 * Created by Toma on 2016/12/9.
 */
// ...操作符
function eachAll(...args) {
    args.forEach(arg => console.log(arg));
}
eachAll(1, 2, 3, 4);

// 反向的
function eachlittl(a, b) {
    console.log(arguments);
}

var args = [2, 1, 5, 7, 8, 9];
eachlittl(...args); // 虽然会报错，但是是对的。


// 系构表达式
function getstock() {
    return {
        code: 'IBM',
        price: {
            price1: 132,
            price2: 10,
        }
    }
}

var {code, price} = getstock();
console.log(code, price);

// 数组的系构表达式
var arr = [1, 2, 3, 9];
var [num1,,num2,...other] = arr;
console.log(num1, num2, other);

function eacl([num1,num2,...other]){
    console.log(num1);
    console.log(num2);
    console.log(other);
}
eacl(arr);